import request from '@/utils/request'

// 查询五金仓领料开单作业列表
export function listCfm(query) {
  return request({
    url: '/output/cfm/list',
    method: 'get',
    params: query,
  })
}

// 查询五金仓领料开单作业详细
export function getCfm(cfmId) {
  return request({
    url: '/output/cfm/' + cfmId,
    method: 'get',
  })
}

// 新增五金仓领料开单作业
export function addCfm(data) {
  return request({
    url: '/output/cfm',
    method: 'post',
    data: data,
  })
}

// 修改五金仓领料开单作业
export function updateCfm(data) {
  return request({
    url: '/output/cfm',
    method: 'put',
    data: data,
  })
}

// 删除五金仓领料开单作业
export function delCfm(cfmId) {
  return request({
    url: '/output/cfm/' + cfmId,
    method: 'delete',
  })
}

// 导出五金仓领料开单作业
export function exportCfm(query) {
  return request({
    url: '/output/cfm/export',
    method: 'get',
    params: query,
  })
}

//获取开单需要的数据
export function getCfdChild(query) {
  return request({
    url: '/output/cfm/getCfdChild',
    method: 'get',
    params: query,
  })
}

//保存开单数据
export function saveCfd(data) {
  return request({
    url: '/output/cfm/addCfdChild',
    method: 'post',
    data: data,
  })
}

//根据单据编号获取开单数据
export function getCfdByOrder(order) {
  return request({
    url: '/output/cfm/getAllCfd/' + order,
    method: 'get',
  })
}

//删除明细单据
export function deleteCfd(id) {
  return request({
    url: '/output/cfm/deleteCfd/' + id,
    method: 'delete',
  })
}

//提交
export function submit(order) {
  return request({
    url: '/output/cfm/submit/' + order,
    method: 'put',
  })
}

//撤回
export function back(order, desc) {
  return request({
    url: '/output/cfm/back/' + order + '/' + desc,
    method: 'put',
  })
}

//审核
export function check(order) {
  return request({
    url: '/output/cfm/check/' + order,
    method: 'put',
  })
}

//出库确认接口
export function confirm(order, cfdId, okSl) {
  return request({
    url: '/output/cfm/confirm/' + order + '/' + cfdId + '/' + okSl,
    method: 'put',
  })
}

//一键检验
export function batchConfirm(order) {
  return request({
    url: '/output/cfm/batchConfirm/' + order,
    method: 'put',
  })
}

//过账接口
export function post(order) {
  return request({
    url: '/output/cfm/post/' + order,
    method: 'put',
  })
}

//五金仓领料报表
export function getReport(param) {
  return request({
    url: '/output/cfmReport/get',
    method: 'get',
    params: param,
  })
}

//导出五金仓领料报表
export function ReportExcel(param) {
  return request({
    url: '/output/cfmReport/report',
    method: 'get',
    params: param,
  })
}
